import 'package:flutter/cupertino.dart';
import 'package:gameplay_flutter/lib_basemodel/user/user.dart';
import '../../lib_baseview/provider.dart';
import '../../lib_network/http_api.dart';
import '../../lib_network/http_helper.dart';

class InformationModel extends JRChangeNotifier {
  /// 用户模型
  User? userInfo;

  /// 是否选中
  bool isBoySelect = true;

  InformationModel(User? user) {
    /// 初始化方法
    userInfo = user;
  }

  /// 默认选中男性
  bool _boySelect = true;
  bool get boySelect => _boySelect;
  void setBoySelectStr(bool sex) {
    _boySelect = sex;
    notifyListeners();
  }

  /// 请求新name
  fetchUpdataName() async {
    var response = await HttpHelper.instance().post(
      HttpApi.nickname,
      showLoading: false,
      showToast: true,
    );
    if (response.isSuccess) {
      userInfo?.nickname = response.result;

      notifyListeners();
    }
  }
}
